Skip to content

[Go] Escape single char fields in generated flyweight String output - #1190

Open
slachiewicz wants to merge 1 commit into
aeron-io:masterfrom
slachiewicz:go-flyweight-single-char-json-escape
Open

slachiewicz wants to merge 1 commit into
aeron-io:masterfrom
slachiewicz:go-flyweight-single-char-json-escape

Conversation

@slachiewicz

Copy link
Copy Markdown
Contributor

The generated flyweight String() formatted a single char field with %c between quotes, so a quote, backslash or control byte broke the JSON. It now writes quote and backslash escaped and control characters as \u00XX, mirroring the C++ display fix, including inside repeating groups.

Part of #969.

Verified: TestSingleCharFieldsRenderAsValidJson fails on master for quote, backslash, newline and control bytes (invalid JSON ... "code": """) and passes here; checkstyle, :sbe-tool:test, verifyJavaIrCodecsInSync, :sbe-samples:check and gocode make pass.

A single char field is written as a JSON string with quote and backslash escaped and control characters as \u00XX, as the C++ display now does. Do not go back to formatting the byte with %c.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant